package com.xing.config.boot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.stereotype.Component;

/**
 * Created by Bradish7Y on 2017/8/21.
 * SpringApplication.exit主动退出时调用，可以在getExitCode中加入释放数据连接、关闭等操作
 */
@Component
public class GracefulExitConfig implements ExitCodeGenerator {
    public static final Logger log = LoggerFactory.getLogger(GracefulExitConfig.class);

    @Override
    public int getExitCode() {
        log.info("exit to my application ....");

        return 1024;
    }
}